﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

/**
 * Sun - size 1
 * Main planets:
 * Mercury - 0,4 ae distance from Sun - oborot 87 days - without satelites
 * Venus -  0,72 ae distane from Sun  - oborot 224 days - without satelites
 * Earth - 1,0 ae distance - from Sun - oborot 365 days - one satelite, moon
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 */


namespace Oblig3XNA
{
    class Planet_old
    {
        Model root;
        Model sun, mercury, venus, earth;
        Matrix isrotSun, isrotMercury, isrotVenus, isrotEarth;

        public Planet_old()
        {

            //matriser
            isrotSun = Matrix.Identity * Matrix.CreateScale(5f);
            isrotMercury = Matrix.Identity * Matrix.CreateScale(0.43f) * Matrix.CreateTranslation(450f, 0f, 0f);
            isrotVenus = Matrix.Identity;
            isrotVenus = Matrix.Identity;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="model"></param>
        internal void load(Model model)
        {
            this.sun = model;
            this.mercury = model;
            this.venus = model;
            this.earth = model;
        }


        internal void unload()
        {
            //throw new NotImplementedException();
        }

        internal void update()
        {
            //sun
            Matrix mr;
            Matrix.CreateRotationY((float)Math.PI / 2000,out mr);
            isrotSun *= mr;
            //mercury
            Matrix orbR = Matrix.CreateRotationY((float)Math.PI/50);
            Matrix orbT = Matrix.CreateTranslation(0.1f, 0f, 0f);
            isrotMercury *= Matrix.CreateRotationY((float)Math.PI / 400) ;// (orbT * orbR) * Matrix.CreateTranslation(15f, 0f, 0f);
            

            
        }

        internal void draw(Microsoft.Xna.Framework.Graphics.BasicEffect effect)
        {
            sun.Draw(isrotSun, effect.View, effect.Projection);
            mercury.Draw(isrotMercury, effect.View, effect.Projection);
        }
    }
}
